home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 001-100 / 001-025 / 023 / ver30 / sys / msdos / putline.asm < prev    next >
Assembly Source File  |  1995-03-17  |  2KB  |  102 lines

  1. ; High speed screen update for Rainbow.
  2. ; putline(row, col, buf);
  3. ; Row and column are origin 1.
  4. ; The buf is a pointer to an array of characters.
  5. ; It won't write past the end of the line in
  6. ; the video RAM; it looks for the FF at the end
  7. ; of the line.
  8. ; This routine by Bob McNamara.
  9. ; put into large model .ASM format by Rich Ellison
  10.  
  11. putline_code    segment byte    public    'code'
  12. extrn    tthue_:word
  13.     public    putline_
  14.     assume    cs:putline_code,ds:nothing,es:nothing,ss:nothing
  15.  
  16. ScrSeg  equ    0ee00h
  17. ScrPtr    equ    3
  18. CMODE    equ    2
  19.  
  20. putline_    proc    far    ; putline(Row, Col, Buf)    /* fast video */
  21. Row    equ    10        ; int    Row;            /*   row addr */
  22. Col    equ    12        ; int    Col;            /*   col addr */
  23. Buf    equ    14        ; char    *Buf;            /*   data     */
  24.                 ; {
  25.     push    si
  26.     push    di
  27.     push    bp
  28.     mov    bp,sp
  29.     push    ds
  30.     push    es
  31.     mov    ax,ScrSeg        ;point extra segment into screen RAM
  32.     mov    es,ax
  33.     mov    di,es:ScrPtr+1        ;di <- base line address
  34.     and    di,0fffh
  35.     mov    al,0ffh
  36.     cld
  37.  
  38.     mov    dx,[bp+Row]        ;row number to write (dx)
  39.     lds    si,dword ptr[bp+Buf]    ;string to be moved ds:(si)
  40.     mov    bx,[bp+Col]        ;column number to start at (bx)
  41.     dec    bx            ;column number starts at 1
  42.     dec    dx            ;row number starts at 1
  43.     jz    l2
  44. l1:    mov    cx,140
  45.     repnz scasb
  46.     mov    di,es:[di]        ;pointer to next line (di)
  47.     and    di,0fffh
  48.     dec    dx
  49.     jnz    l1
  50. l2:    add    di,bx            ;di -> offset in row
  51.     push    di
  52.  
  53. l3:    cmp    al,es:[di]
  54.     jz    l4
  55.     movsb
  56.     cmp    al,es:[di]
  57.     jz    l4
  58.     movsb
  59.     cmp    al,es:[di]
  60.     jz    l4
  61.     movsb
  62.     cmp    al,es:[di]
  63.     jz    l4
  64.     movsb
  65.     cmp    al,es:[di]
  66.     jz    l4
  67.     movsb
  68.     cmp    al,es:[di]
  69.     jz    l4
  70.     movsb
  71.     cmp    al,es:[di]
  72.     jz    l4
  73.     movsb
  74.     cmp    al,es:[di]
  75.     jz    l4
  76.     movsb
  77.     jmp    l3
  78. l4:
  79.     pop    cx
  80.     mov    ax,cx
  81.     sub    di,cx
  82.     mov    cx,di            ;cx contains repeat count
  83.     add    ax,1000h        ;point into attribute portion of RAM
  84.     mov    di,ax            ;di contains pointer into attr. RAM
  85.     mov    ax,0fh            ;assume rev. video
  86.     cmp    word ptr tthue_,CMODE    ;is this for mode line?
  87.     jz    l5            ;yes
  88.     mov    ax,0eh            ;no, clear attributes
  89. l5:
  90.     rep stosb
  91.  
  92.     pop    es
  93.     pop    ds
  94.     pop    bp
  95.     pop    di
  96.     pop    si
  97.     ret
  98. putline_    endp
  99.  
  100.     putline_code    ends
  101.     end
  102.